/**
 * 直播业务操作
 */

const liveModel = require('../models/live-info');
const liveCode = require('../codes/live');

const live = {

	/**
	 * 获取在线直播列表信息
	 * @param  {string}
	 * @return {object|null}     查找结果
	 */
	async getLiveInfo(formData) {
		let resultData = await liveModel.getLiveInfo(formData) || {};
		let liveInfo = resultData;
		return liveInfo;
	},
	
	/**
	 * 增加用户直播信息
	 * @param  {string}
	 * @return {object|null}     查找结果
	 */
	async createLiveInfo(formData, user_id) {
		let resultData = await liveModel.createLiveInfo(formData) || {};
		let liveInfo = resultData;
		return liveInfo;
	},

	/**
	 * 更新用户直播信息
	 * @param  {string}
	 * @return {object|null}     查找结果
	 */
	async updateLiveInfo(formData, user_id) {
		let resultData = await liveModel.updateLiveInfo(formData, user_id) || {};
		let liveInfo = resultData;
		return liveInfo;
	},
};

module.exports = live;